package io.github.flypiggy.stack.operate.log.spring.boot.starter.properties.enums;


public enum DateSuffixEnum {
    /**
     * Year as index suffix.
     */
    YEAR,
    /**
     * Month as index suffix.
     */
    MONTH,
    /**
     * Day as index suffix.
     */
    DAY;

    public static String getEsSuffixPattern(DateSuffixEnum suffixEnum) {
        String suffixPattern = "";
        switch (suffixEnum) {
            case DAY:
                suffixPattern = "_yyyy.MM.dd";
                break;
            case MONTH:
                suffixPattern = "_yyyy.MM";
                break;
            case YEAR:
                suffixPattern = "_yyyy";
        }
        return suffixPattern;
    }

    public static String getJdbcSuffixPattern(DateSuffixEnum suffixEnum) {
        String suffixPattern = "";
        switch (suffixEnum) {
            case DAY:
                suffixPattern = "_yyyy_MM_dd";
                break;
            case MONTH:
                suffixPattern = "_yyyy_MM";
                break;
            case YEAR:
                suffixPattern = "_yyyy";
        }
        return suffixPattern;
    }

    public static String getMongoSuffixPattern(DateSuffixEnum suffixEnum) {
        return getJdbcSuffixPattern(suffixEnum);
    }
}
